package com.css.fxfzfxqh.modules.singleIndexRiskZoning.controller;

import com.css.fxfzfxqh.base.response.RestResponse;
import com.css.fxfzfxqh.modules.singleIndexRiskZoning.model.entity.FxqhAssessPdQhResult;
import com.css.fxfzfxqh.modules.singleIndexRiskZoning.model.vo.FxqhAssessPdQhResultVo;
import com.css.fxfzfxqh.modules.singleIndexRiskZoning.service.ProbabilityAssessQhService;
import com.css.fxfzfxqh.util.PlatformObjectUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 概率评估风险区划接口
 */
@Slf4j
@RequestMapping("probabilityAssessQh")
@RestController
public class ProbabilityAssessQhController {

    @Autowired
    private ProbabilityAssessQhService probabilityAssessQhService;

    /**
     * 区划计算
     *
     * @param taskId
     * @return
     */
    @RequestMapping("/doZoning")
    public RestResponse doZoning(@RequestParam String taskId,String selectedVal) throws Exception{
        return probabilityAssessQhService.doZoning(taskId,selectedVal);
    }

    /**
     * 查询区划值列表
     * @param param
     * @return
     */
    @GetMapping("getAssessPdQhList")
    public RestResponse<List<FxqhAssessPdQhResultVo>> getAssessPdQhList(FxqhAssessPdQhResult param) {
        try {
            List<FxqhAssessPdQhResultVo> list = probabilityAssessQhService.getAssessPdQhList(param);
            return RestResponse.succeed(list);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return RestResponse.fail(e.getMessage());
        }
    }

}
